@extends('mobile.template.bootstrap')
@section('title', '首页')
@section('scripts')
<link rel="stylesheet" href="{{asset('css/mobile-index.css')}}" />
<script src="{{asset('js/app/mobile-index.js')}}"></script>
@endsection
@section('top')
<div class="navbar  navbar-self">
	<div class="left">
		<a href="{{ url('/mobile/history') }}">
			<span class="fa fa-history fa-fw"></span>
		</a>
	</div>
	<div class="mid ">
		007书房
	</div>
	<div class="right">
		<a href="{{ url('/mobile/search') }}">
			<span class="fa fa-search fa-fw"></span>
		</a>
	</div>
</div>
@endsection
@section('content')
<section class="slider-tabs">
	<div class="tabs-container">
		<ul class="tabs">
			<li class="tab @if(!isset($ctOrder)) active @endif"><a href="{{ url('/mobile') }}">热门推荐</a></li>
			@foreach($categories as $category)
				<li class="tab @if(isset($ctOrder) AND $ctOrder == $category['order']) active @endif"><a href="{{ url('/mobile/categories/'.$category['order']) }}">{{ $category['name'] }}</a></li>
			@endforeach
		</ul>
	</div>
</section>
<section class="books-container">
	<div class="books">
		@foreach($books as $book)
		<div class="book">
			<div class="media">
				<div class="media-left">
					<a href="{{ url('/mobile/books/'.$book->id) }}">
						<img class="book-thumbnail" class="media-object" src="{{ $book->thumbnailUrl() }}" width="67.5" height="90"/>
					</a>
				</div>
				<div class="media-body">
					<div class="media-heading">
						<div class="title">
							<a href="{{ url('/mobile/books/'.$book->id) }}">
								<h4 class="">{{ $book->name }}</h4>
								<div class="text-muted book-abstract">{{ $book->author }}</div>
							</a>
						</div>
						<div class="link">
							@if(Session::has($book->id))
							<a class="btn btn-sm btn-default" href="{{ url('/mobile/books/'.$book->id.'/sections/'.Session::get($book->id)) }}">
							@elseif($book->getFirstSection())
							<a class="btn btn-sm btn-default" href="{{ url('/mobile/books/'.$book->id.'/sections/'.$book->getFirstSection()->order) }}">
							@else
							<a class="btn btn-sm btn-default" href="{{ url('/mobile/books/'.$book->id) }}">
							@endif
								立即阅读
							</a>
						</div>
					</div>
					<a href="{{ url('/mobile/books/'.$book->id) }}">
						<div class="content text-muted book-abstract">
							{!! str_limit(strip_tags($book->abstract), 200) !!}
						</div>
					</a>
				</div>
			</div>
		</div>
		@endforeach
	</div>
</section>
@endsection